package Filter;

import javax.servlet.Servlet;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;

public class experiment_5_1 extends HttpServlet {
    public experiment_5_1() {
        super();
    }

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        PrintWriter out=resp.getWriter();
        resp.setCharacterEncoding("UTF-8");
        resp.setContentType("text/html;chaset =UTF-8");

        String un = req.getParameter("un");

        req.setAttribute("un",un);

        out.println("<HTML>");
        out.println("<HEAD><TITLE>5.1</TITLE></HEAD>");
        out.println("<BODY>");
        out.println("username:" + un + "<br>");
        out.println("</BODY>");
        out.println("</HTML>");
    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        doGet(req, resp);
    }
}
